<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<div class="wrapper-main">
    <div class="headlabel"><?php echo $this->__('SIGN IN') ?></div><br />
    <p class="notes"><?php echo $this->__('* Indicate requiet field') ?></p><br />
    <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
    <form class="jNice" action="<?php echo $this->getUrl('customer/account/editPost') ?>" method="post" id="form-validate">
        <div class="content-create">
            <div class="col-1">
            <?php echo $this->getBlockHtml('formkey')?>
                <div class="box-left register">
                    <div class="box-left register">
                        <h4 class="legend"><?php echo $this->__('Your Information') ?></h4>
                        <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getCustomer())->toHtml() ?>
                        <!--
                        <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                        <div class="input-box">
                            <input type="text" name="email" id="email" value="<?php //echo $this->htmlEscape($this->getCustomer()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text required-entry validate-email" />
                        </div>
                        -->

                        <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>

                        <?php if ($_dob->isEnabled()): ?>
                            <?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?>
                        <?php endif ?>
                        <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
                        <?php if ($_taxvat->isEnabled()): ?>
                            <?php echo $_taxvat->setTaxvat($this->getCustomer()->getTaxvat())->toHtml() ?>
                        <?php endif ?>
                        <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
                        <?php if ($_gender->isEnabled()): ?>
                            <?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?>
                        <?php endif ?>
                        
                    </div>
                </div>
                <div>
                    <input type="checkbox" name="change_password" id="change_password" value="1" onclick="setPasswordForm(this.checked)" title="<?php echo $this->__('Change Password') ?>"<?php if($this->getCustomer()->getChangePassword()==1): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="change_password"><?php echo $this->__('Change Password') ?></label>
                </div>
                <div class="box-left register">

                    <h4 class="legend"><?php echo $this->__('Change Password') ?></h4>
                        <div class="content-box">
                            <fieldset>
                                <label for="current_password" class="required"><?php echo $this->__('Current Password') ?>
                                    <span>*</span>
                                </label>
                                <input type="password" title="<?php echo $this->__('Current Password') ?>" class="" name="current_password" id="current_password" />
                            </fieldset>
                  
                            <fieldset>
                                <label for="password" class="required"><?php echo $this->__('New Password') ?><span>*</span></label>
                                <input type="password" title="<?php echo $this->__('New Password') ?>" class="validate-password" name="password" id="password" />
                            </fieldset>
                            <fieldset>
                                <label for="confirmation" class="required"><?php echo $this->__('Confirm Password') ?><span>*</span></label>
                                <input type="password" title="<?php echo $this->__('Confirm Password') ?>" class="validate-cpassword" name="confirmation" id="confirmation" />
                            </fieldset>
                     </div>
                </div>
                <div class="box-left register">
                    <h4><?php echo $this->__("Contact Infomation") ?></h4>
                    <div class="content-box">
                        <fieldset>
                            <label>Phone<span>*</span></label>
                            <input  type="text"/>
                        </fieldset>
                        <fieldset>
                            <label><?php echo $this->__("Email") ?><span>*</span></label>
                            <input type="text" name="email" id="email" value="<?php echo $this->htmlEscape($this->getCustomer()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text required-entry validate-email" />
                        </fieldset>
                        <fieldset>
                            <label>Fax<span>*</span></label>
                            <input  type="text"/>
                        </fieldset>
                        <fieldset>
                            <label>Website<span>*</span></label>
                            <input  type="text"/>
                        </fieldset>
                    </div>
                </div><!--end box left-->
                
                <?php //getDefaultBillingAddress() ?>
                <div class="box-left register">
                        <h4>Company Infomation</h4>
                        <div class="content-box">
                            <fieldset>
                                <p class="bold">Please tell us a little about your business and how<br /> you like to use our parts?</p><br />
                                <p>(In 500 words or less)</p>
                            </fieldset>

                            <fieldset>
                                <textarea></textarea>
                            </fieldset>
                        </div>
                </div>
                <?php
                    $customer = $this->getCustomer();
                    //$billingAdress = Mage::getModel("customer/customer")->load($customer->getId())->getDefaultBillingAddress();
                    $billingAddress = $customer->getDefaultBillingAddress();
                    
                    //var_dump($billingAdress);
                    //die;
                    //$billingAdress = Mage::getModel("customer/customer")->load()
                ?>
            </div>
            <div class="col-2">
                <div class="box-left register">
                    <h4><?php echo $this->__("Billing Address") ?></h4>
                    <div class="content-box">
                        <?php $_streetValidationClass = $this->helper('customer/address')->getAttributeValidationClass('street'); ?>
                        <?php echo $street = $billingAddress->getStreet() ?>
                        <fieldset>
                            <label><?php echo $this->__("Address") ?><span>*</span></label>
                            <input type="text" name="street[]" value="<?php echo @$street[0] ?>" id="street_1" class="<?php echo $_streetValidationClass ?>" />
                        </fieldset>
                        <fieldset>
                            <label>Address(line2)<span>*</span></label>
                            <input type="text" name="street[]" value="<?php echo @$street[1] ?>" id="street_2" class="<?php echo $_streetValidationClass ?>" />
                        </fieldset>
                        <fieldset>
                            <label><?php echo $this->__("City") ?><span>*</span></label>
                            <input type="text" name="city" value="<?php echo $billingAddress->getCity() ?>" title="<?php echo $this->__('City') ?>" class="<?php echo $this->helper('customer/address')->getAttributeValidationClass('city') ?>" id="city" />
                        </fieldset>
                        <fieldset>
                            <label for="region_id" class="required"><?php echo $this->__('State/Province') ?><span>*</span></label>
                                    <select id="region_id" name="region_id" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
                                        <option value=""><?php echo $this->__('Please select region, state or province') ?></option>
                                    </select>
                                    <script type="text/javascript">
                                    //<![CDATA[
                                        $('region_id').setAttribute('defaultValue', "<?php echo $this->getFormData()->getRegionId() ?>");
                                    //]]>
                                    </script>
                                    <input type="text" id="region" name="region" value="<?php echo $billingAddress->getRegion() ?>" title="<?php echo $this->__('State/Province') ?>" class="<?php echo $this->helper('customer/address')->getAttributeValidationClass('region') ?>" style="display:none;" />
                        </fieldset>
                        <fieldset>
                            <label for="country" class="required"><?php echo $this->__('Country') ?><span>*</span></label>
                            <?php echo $this->getCountryHtmlSelect() ?>
                        </fieldset>
                        <fieldset>
                            <label for="zip" class="required"><?php echo $this->__('Zip/Postal Code') ?><span>*</span></label>
                            <input type="text" name="postcode" value="<?php echo  $billingAddress->getPostcode() ?>" title="<?php echo $this->__('Zip/Postal Code') ?>" id="zip" class="zipcode validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
                        </fieldset>
                    </div>
            </div>
        </div>
        
        
             
           
        
        <div class="buttons-set">
            <p class="required"><?php echo $this->__('* Required Fields') ?></p>
            <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
            <button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
        </div>
    </form>
</div>
<script type="text/javascript">
//<![CDATA[
    var dataForm = new VarienForm('form-validate', true);
    
    function setPasswordForm(arg){
        if(arg){
            
            $('current_password').up(3).show();
            $('current_password').addClassName('required-entry');
            $('password').addClassName('required-entry');
            $('confirmation').addClassName('required-entry');

        }else{
            $('current_password').up(3).hide();
            $('current_password').removeClassName('required-entry');
            $('password').removeClassName('required-entry');
            $('confirmation').removeClassName('required-entry');
        }
    }
    <?php if($this->getCustomer()->getChangePassword()): ?>
        setPasswordForm(true);
    <?php endif; ?>
//]]>
</script>
